package inheritance;

abstract class Vehicle {
    public abstract double calcFuelEfficiency();
    public abstract double calcTripDistance();
}

class Company {
    public void showDist(Vehicle v) {
        System.out.println(v.calcTripDistance());

    }
    public void showFuelEfficiency(Vehicle v) {
        System.out.println(v.calcFuelEfficiency());
    }

    public static void main(String[] args) {
        Truck t = new Truck();
        RiverBarge r = new RiverBarge();
        //System.out.println();
        Company c = new Company();
        c.showDist(t);
        c.showFuelEfficiency(t);
        c.showDist(r);
        c.showFuelEfficiency(r);

    }
}

class Truck extends Vehicle{

    @Override
    public double calcFuelEfficiency() {
        return 1;
    }

    @Override
    public double calcTripDistance() {
        return 2;
    }
}

class RiverBarge extends Vehicle{

    @Override
    public double calcFuelEfficiency() {
        return 3;
    }

    @Override
    public double calcTripDistance() {
        return 4;
    }
}
